// Copyright (C) 2005 Taylor L. Riche <riche@cs.utexas.edu>
//  
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software 
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// $Id: dagtools.hh 61 2005-07-28 17:01:05Z richetl $
//
// -----------------------------------------------------------------

#ifndef DAGTOOLS_H
#define DAGTOOLS_H

#include <iostream>
#include <assert.h>
#include <stdexcept>

#ifdef TT_BUILD
#include "packet.hh"
#include "tracetools.hh"
#else
#include <tracetools/packet.hh>
#include <tracetools/tracetools.hh>
#endif

namespace tt {

struct DagFormat
{   
  uint64_t timestamp;
  uint32_t wand_crc;
  uint32_t atm_header;
  uint64_t llc_snap;
  char     payload[40];
} __attribute__ ((packed));

class DagReader : public TraceReader
{
public:
  DagReader(std::string fn) throw(std::invalid_argument);
  virtual ~DagReader();
  virtual void readPacket(Packet & newPacket) throw(std::underflow_error);
private:
  FILE * dagFile;
};

class DagWriter : public TraceWriter
{
public:
  DagWriter(std::string fn) throw(std::invalid_argument);
  virtual ~DagWriter();
  virtual void writePacket(const Packet & targetPacket);
private:
  FILE * dagFile;
};
}
#endif // DAGTOOLS_H
